Back to course home
0% completed
Vote For New Content
Integer to English Words (hard)
Problem Statement
Given a positive integer num, return the English word representation of num.
Examples
-
Example 1:
- Input: num =
12345 - Expected Output:
"Twelve Thousand Three Hundred Forty Five" - Justification: The number 12345 is broken down into "Twelve Thousand" for the first two digits, followed by "Three Hundred" for the next digit, and "Forty Five" for the last two digits.
- Input: num =
-
Example 2:
- Input: num =
1001 - Expected Output:
"One Thousand One" - Justification: The number 1001 translates to "One Thousand" for the first digit and "One" for the last digit, skipping the hundreds and tens place because they are zeros.
- Input: num =
-
Example 3:
- Input: num =
2000000 - Expected Output:
"Two Million" - Justification: The number 2000000 is simply "Two Million" as there are no other numbers to represent after the word "Million".
- Input: num =
Try it yourself
Try solving this question here:
Java
. . . .
Solution: Validate Binary Search Tree
Solution: Integer to English Words
Mark as Completed
On this page
Problem Statement
Examples
Try it yourself